Repository navigation
snapshot: serve snapshots to p2p neighbours (P3) - #102
Merged
Merged
Conversation
SnapshotProvider answers manifest and piece requests from the newest snapshot this node built: verified on load, files kept open, pieces read with pread, a global and a per-peer token bucket, two pieces per peer every 100 ms, at most serve_max_peers peers in 30 s, half the budget while trusted, manifests once per peer every 5 s. SnapshotService (from #98, without the HTTP server) builds the snapshot of each periodic checkpoint while serve is on and loads it into the provider. Snapshots use 512 KiB chunks and no contracts file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… clock Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rve a snapshot; snapshot-p2p-serve scenario Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
EnzinoBB
force-pushed
the
feat/snapshot-p2p-provider
branch
from
October 25, 2026 12:14
83890a5 to
11192d1
Compare
EnzinoBB
marked this pull request as ready for review
October 25, 2026 12:14
The service resets its failure count and is woken under its lock, and a snapshot that does not load is removed and built again (at most five times). The provider evicts idle keys before a downloading peer, sends one manifest to anyone every 50 ms, counts each chunk once towards a completed download, and asks the kernel to keep the snapshot files cached. KB/s documented. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…aders exempt Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…es from odd nodes (mixed runs) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Step P3 of docs/plans/2026-10-25-snapshot-p2p-plan.md (design section 5). Draft: the private-network scenario comes once #101 (P2) is merged and this branch is rebased on it.
SnapshotProvider: answers manifest and piece requests from the newest snapshot this node built. The snapshot is verified on load (manifest, signature, seq, file sizes, chunk size at most 1 MiB and a power of two), files are kept open and read withpread; a request names a manifest entry, never a path.serve_rate_kbps, KB/s, burst 4 MiB), a per-peer one at half the global rate, two pieces per peer every 100 ms, at mostserve_max_peerspeers within 30 s, half of everything while the node is trusted; manifests once per peer every 5 s and charged to the global bucket; a 64-entry peer table.serve=off), building (nothing loaded), not synced (design 5.2: not syncing, no bootstrap round, at most 3 blocks behind a known round), busy withretry_ms, unknown.SnapshotServicefrom csnode: snapshots served by the node over HTTP #98 without the HTTP server: builds oncheckpointSavedEventwhileserveis on, loads the newest complete snapshot into the provider, unloads onserve=off.BlockChain::blockBytes/pruneTarget/checkpointSavedEvent,Storage::pool_bytes, the builder's streaming copy of checkpoint files (from csnode: snapshots served by the node over HTTP #98).--export-snapshot), no contracts file (the checkpoint carries the contract states at its block).SNAPSHOT: serving block S (N files, M MB),served block S to <key>, M MB in T s, an hourly traffic summary.tests/csnode/snapshot_provider_tests.cpp.🤖 Generated with Claude Code